<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js操作style</title>
	<script type="text/javascript">
		window.onload = function(){
			var oDiv = document.getElementById('div1');
			oDiv.style.color = "red";
			oDiv.style.background = "gold";
			oDiv.style.fontSize = '20px';
		}

	</script>
</head>
<body>
	<div id = "div1">这是一个DIV元素</div>
</body>
</html>